package com.fr.report.core.headerfooter;

import com.fr.base.FRFont;
import java.text.DateFormat;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;

public class DateHFElement extends TextHFElement
{
  private Format dateFormat;

  public DateHFElement()
  {
    this.dateFormat = null;
    setFormat(new SimpleDateFormat("yyyy-MM-dd"));
  }

  public DateHFElement(FRFont paramFRFont)
  {
    this(paramFRFont, new SimpleDateFormat("yyyy-MM-dd"));
  }

  public DateHFElement(FRFont paramFRFont, DateFormat paramDateFormat)
  {
    super("", paramFRFont);
    this.dateFormat = null;
    setFormat(paramDateFormat);
  }

  public String getText()
  {
    return getFormat().format(Calendar.getInstance().getTime());
  }

  public Format getFormat()
  {
    return this.dateFormat;
  }

  public void setFormat(Format paramFormat)
  {
    this.dateFormat = paramFormat;
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    DateHFElement localDateHFElement = (DateHFElement)super.clone();
    if (getFormat() != null)
      localDateHFElement.setFormat((Format)getFormat().clone());
    return localDateHFElement;
  }
}